void laser :: init()
{
    using namespace laser;
    // laser DOT
    n_laserdot   = n_root -> createChildSceneNode("laser dot");
    bb_laserdot  = scmgr  -> createBillboardSet("laser dot");
    n_laserdot -> attachObject (bb_laserdot);
    bb_laserdot -> setMaterialName("jokoon/laser_dot");
    float laserdot_scale = GetFloat("dotscale");
    n_laserdot -> setScale(Vec3(laserdot_scale,laserdot_scale,laserdot_scale));
    bboard       = bb_laserdot -> createBillboard(Ogre :: Vector3(0, 0, 0));

    // laser BEAM
    laser_width = GetFloat("laser_width");
    n_laserbeam  = n_root -> createChildSceneNode("laser beam");
    bb_beam      = scmgr  -> createBillboardChain("laser beam");
    n_laserbeam -> attachObject (bb_beam);
    bb_beam -> setMaterialName("jokoon/laser_beam");
    bb_beam -> setMaxChainElements(2);
#if OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR == 8

    bb_beam -> addChainElement (0, BillboardChain::Element
        (Vec3(0, 0, 100), laser_width, 0, ColourValue(), Quaternion::IDENTITY));
    bb_beam -> addChainElement (0, BillboardChain::Element
                                (Vec3(0, 0, 0), laser_width, 0, ColourValue(), Quaternion::IDENTITY));
    
#elif OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR == 7

    bb_beam -> addChainElement (0, BillboardChain::Element
                                (Vec3(0, 0, 100), laser_width, 0, ColourValue()));
    bb_beam -> addChainElement (0, BillboardChain::Element
                                (Vec3(0, 0, 0), laser_width, 0, ColourValue(
                                 )));
#endif
    
    bb_beam -> setUseTextureCoords(true);
    bb_beam -> setTextureCoordDirection(BillboardChain :: TCD_V);

    bb_beam->setQueryFlags(qf_effect);
    bb_laserdot->setQueryFlags(qf_effect);

}

#ifdef USE_BULLET
void laser :: update()
{
    using namespace laser;
    // setting ray to camera orientation
    from = camera -> getRealPosition() + camera ->getRealDirection(); // from
    //n_gizmo[0]->setPosition(temp);

    btfrom = BtOgre::Convert::toBullet(from);
    btto = BtOgre::Convert::toBullet(from + camera -> getRealDirection() * 500.0f);

    raycallback = btCollisionWorld::ClosestRayResultCallback (btfrom,btto);
    //raycallback.m_rayFromWorld = btVector3(temp.x,temp.x,temp.x);
    //raycallback.m_rayToWorld = btVector3(temp1.x,temp1.y,temp1.z);
    colw -> rayTest (btfrom, btto, raycallback);
    
    if(raycallback.hasHit())
    {
        btfrom = raycallback.m_hitPointWorld;
        n_laserdot -> setPosition(BtOgre::Convert::toOgre(btfrom));
        //LOGSTREAM<< "JUST HIT";
#if OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR == 7
    bb_beam -> updateChainElement
        (0, 0, BillboardChain :: Element
            (BtOgre::Convert::toOgre(btfrom), laser_width, 0, ColourValue()));
    bb_beam -> updateChainElement
        (0, 1, BillboardChain :: Element
            (camera -> getRealPosition() + Vec3(0,2,0), laser_width, 0, ColourValue()));
#elif OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR == 8
        bb_beam -> updateChainElement
        (0, 0, BillboardChain :: Element
         (BtOgre::Convert::toOgre(btfrom), laser_width, 0, ColourValue(), Quaternion::IDENTITY));
        bb_beam -> updateChainElement
        (0, 1, BillboardChain :: Element
         (camera -> getRealPosition() + Vec3(0,2,0), laser_width, 0, ColourValue(), Quaternion::IDENTITY));
#endif
    }

    //last_entity, current_entity;
    //if (ent_check == last_entity);
    //else
    //{
    //  //static_cast<SceneNode*>(last_entity->getParentNode())->showBoundingBox(false);
    //  //static_cast<SceneNode*>(ent_check->getParentNode())->showBoundingBox(true);
    //  //last_entity = ent_check;
    //}
}
#endif
